<!doctype html>
[#escape x as (x)!?html]
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <title>留言板 - ${site.seoTitle} - Powered by JPROCMS</title>
  <meta name="keywords" content="留言板">
  [#include '../includes/common_res.html'/]
</head>
<body>
[#assign shadowNav=true/]
[#include '../includes/header.html'/]
<div class="container">
  <div class="row">
    <div class="col mt-1">
      <div class="d-flex align-items-center py-1 border-bottom">
        <div class="flex-grow-1 h5 mb-0"><a href="${base}/guestbook">留言板</a></div>
        <div id="guestbookPostBtnDiv"><a class="btn btn-primary" href="${base}/guestbook/post" role="button">我要留言</a></div>
      </div>
      <div class="py-1 border-bottom">
        <a href="${ZParamsJoin('guestbook','guestbook','isReplied')}" class="btn btn-sm [#if !Params.isReplied??]btn-secondary[#else]btn-link text-reset[/#if]">全部留言</a>
        <a href="${ZParamsJoin('guestbook','guestbook','isReplied','1')}" class="btn btn-sm [#if Params.isReplied! =='true']btn-secondary[#else]btn-link text-reset[/#if]">已回复留言</a>
        <a href="${ZParamsJoin('guestbook','guestbook','isReplied','0')}" class="btn btn-sm [#if Params.isReplied! =='false']btn-secondary[#else]btn-link text-reset[/#if]">未回复留言</a>
      </div>
      <div class="py-1 border-bottom">
      [@ZDictList type='cms_guestbook_type'; list]
        <a href="${ZParamsJoin('guestbook','guestbook','type')}" class="btn btn-sm[#if !Params.type??] btn-secondary[#else] btn-link text-reset[/#if]">全部类别</a>
        [#list list as dict]
          <a href="${ZParamsJoin('guestbook','guestbook', 'type', dict.value)}"
             class="btn btn-sm [#if Params.type! == dict.value]btn-secondary[#else]btn-link text-reset[/#if]">${dict.label}</a>
        [/#list]
      [/@ZDictList]

      </div>
      [@ZGuestbookPage type=Params.type isReplied=Params.isReplied  count='10';pageResult]
        <ul class="list-unstyled">
          [#list pageResult.list as g]
            <li class="mt-3 pb-3 border-bottom position-relative">
              <div class="d-flex align-items-center">
                <div class="badge badge-info mr-2">${g.type.name}</div>
                <div class="flex-grow-1 text-truncate"><a href="${base}/guestbook/${g.id?c}" class="text-reset stretched-link">${g.title!ZSubstring(g.msgText,100,'...')}</a></div>
                <div>[#if g.hasReplied]<span class="badge badge-success">已回复</span>[#else]<span class="badge badge-secondary">未回复</span>[/#if]</div>
              </div>
              <p class="small text-muted my-2 cm-truncate2">${ZSubstring(g.msgText,1000,'...')}</p>
              <div class="small text-black-50 mt-2 clearfix">
                <div class="float-left"><i class="far fa-user"></i> ${g.username!g.nickname!"匿名网友"}</div>
                <div class="float-right"><i class="ml-2 far fa-clock"></i> ${ZFormat(g.createTime, 'yyyy-MM-dd HH:mm:ss')}</div>
              </div>
            </li>
          [/#list]
        </ul>
        [#include '../includes/inc_page.html'/]
      [/@ZGuestbookPage]
    </div>
  </div>
</div>
<script>
  $(function () {
    const tokenExpiredTime = sessionStorage.getItem("expiresTime");
    [#if site.siteConfig.guestbook.needLogin]
      if (!isExpired(tokenExpiredTime)) {
        $("#guestbookPostBtnDiv").show();
      }else{
        $("#guestbookPostBtnDiv").hide();
      }
    [/#if]
  });
</script>
[#include '../includes/footer.html'/]
[#include '../includes/inc_msg.html'/]
</body>
</html>
[/#escape]
